<?php
namespace App\SDK\PingAn;

use App\SDK\PingAn\service\Download;
use App\SDK\PingAn\service\Token;
use App\SDK\PingAn\service\Common;
use App\SDK\PingAn\service\Upload;

class Service {
    private static $_instance;

    public static function instance()
    {
        if (self::$_instance == null) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    public function getToken() {
        return (new Token)->get();
    }

    public function commonRequest($data, $method) {
        return (new Common)->request($data, $method);
    }

    public function invoke($data, $method) {
        return (new Common)->invoke($data, $method);
    }

    public function upload($file, $filePathName) {
        return (new Upload)->request($file, $filePathName);
    }

    public function download($fileNo, $saveFile) {
        return (new Download)->request($fileNo, $saveFile);
    }
}
